#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct 
{
	int id;
	char name[10];
	char password[20];
}student;

void func(char name[10])
{
	printf("%s\n",name);
	student* st = (student*)malloc(sizeof(student));
	strcpy(st->name,name);//[重点2]
	printf("%s\n",st->name);
}

int main()
{
	
	//char name[10];
	//printf("input:");
	//scanf("%s",name);
	//printf("output:%s\nlen = %d\n",name,strlen(name));
	//[问题1]:不知道中文字符占几个字节

	//char name[10] = "是指林";
	//func(name);
	//[问题2]:如何对结构体的字符串变量赋值,通过string里的拷贝语句实现[不要问为什么]
	
	FILE* fa = fopen("a.txt","r");
	if(fa == NULL) printf("文件为空\n");
	student* st = (student*)malloc(sizeof(student));
	printf("%d\n",st->id);
	fread(&st,sizeof(student),1,fa);
	printf("%d %s %s\n",st->id,st->name,st->password);
	fclose(fa);
	//[问题3]:如何将文件与指针链表相联系
}
